# -*- coding:utf-8 -*-
"""
@Time : 2022/4/27 5:24 PM
@Author: binkuolo
@Des: 用户管理
"""
from datetime import date
import os
import time

from app.common.common import write_access_log
from app.common.sms import check_code
from core.Response import success, fail, res_antd
from models.base import AdPicture
from schemas.portal import ad
from core.Utils import en_password, check_password, random_str
from core.Auth import create_access_token, check_permissions
from fastapi import Request, Query, APIRouter, Security, File, UploadFile
from config import settings
from typing import List
from tortoise.queryset import F

router = APIRouter(prefix='')

@router.get("",
            summary="广告列表",
            response_model=ad.AdListData,
            )
async def ad_list(a_key:str):
    """
    获取所有广告
    :return:
    """
    ad_data = await AdPicture.filter(ad__a_key=a_key).values('title', 'pic', 'link')
    print(ad_data)
    return success(data=ad_data)